<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>实现外部对data数据的获取</title>
</head>
<body>
    <script>
        function getData(resolve,reject){
    setTimeout(()=>{
        let data = {code:200,msg:'success',data:[]}
        resolve(data)
    },1000)
}
p.then(function(data){
        // console.log(data)
    })
    async function fn(){
        let data1= await p
        console.log(data1)
    }
    fn()
    </script>
</body>
</html>